from pygame.time import Clock
import types


class Game:
    
    def __init__(self, player, systems):
        self.keys = None
        self.dt = 0
        self.clock = Clock()
        self.clock.tick()
        self.player = player
        if not isinstance(systems, types.ListType):
            self.systems = [systems]
        else:
            self.systems = systems
        
    def update(self):
        self.clock.tick()
        self.dt = self.clock.get_time() / 1000.0
        # Update the player
        self.player.update(self)
        # Update the systems
        [system.update(self) for system in self.systems]
        
        #print self.dt
        
        
    def draw(self, surface):
        [system.draw(surface) for system in self.systems]
        self.player.draw(surface)
        
        